<template>
  <div>
    <component :is="one"></component>

    <div id="container">
      <div id="content">
        <h2><strong>欢迎使用第四组项目申报系统</strong></h2>

        <div class="splitcontentleft">
          <div class="box">
            <h3><img src="../../../images/lxrycyy.gif" alt="" width="184" height="124" /></h3>
          </div>
        </div>

        <div class="splitcontentright">
          <p>项目申报管理系统开发成本低，投入资金少。可以使项目申报的各项管理工作， 变得方便快捷，不仅节省了时间，还节省了人力，提高了准确性。项目管理部门通过自己的网站，能够大大提高工作的透明度以及工作效率。</p>

          <p><strong>Good luck with your new design!</strong></p>
        </div>
      </div>

      <div id="subcontent">
        <div class="small box">
          <table id="app" width="150" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="30%" valign="middle"><img src="images\username.jpg" width="70" height="20" align="bottom" />
                <input name="username" id="username" v-model="username" type="text" size="7" />
              </td>
            </tr>
            <tr>
              <td valign="middle"><img src="images\password.jpg" width="70" height="20" />
                <input name="password" id="password" v-model="password" type="password" size="7" />
              </td>
            </tr>
            <tr>
              <td>
                <img src="images/login_1_7.jpg" width="61" height="17" type="button" @click="login()" value="请登录"/>
<!--                <input type="button" @click="login()" value="请登录" />-->

              </td>

            </tr>
          </table>
        </div>
        <h2>友情链接</h2>
        <ul class="menublock">
          <li><a href="http://www.ascenttech.cn" target="_blank">亚思晟视频在线</a></li>
          <li><a href="http://www.ascenttech.com.cn/" target="_blank">亚思晟公司主页</a></li>
        </ul>

      </div>

    </div>
    <component :is="two"></component>
  </div>
</template>
<script>
  import aaa from '../../components/header.vue'
  import bbb from '../../components/footer.vue'
  import four from '../../util/four';
  export default {
    components: {
      aaa, bbb
    },
    data() {
      return {
        one: 'aaa',
        two: 'bbb',
        username: "",
        password: "",
      }
    },
    methods: {
      login() {
        four.get("/users/" + this.username + "/" + this.password).then((res) => {
          if (res.data.code == 20040) {
            this.$message.error("登录失败！用户名或密码错误！");
          }
          //登录成功
          if (res.data.code == 20041) {
            //将uid存入session
            sessionStorage.setItem("userid", JSON.stringify(res.data.data.uid));
            sessionStorage.setItem("username", JSON.stringify(this.username));
            //管理员登录
            if (res.data.data.gid == "1") {
              // this.$message.success("ok");
              this.$router.push('/admin');
            }
            //专家登录
            if (res.data.data.gid == "2") {
              this.$router.push('/expert');
            }
            //普通用户登录
            if (res.data.data.gid == "3") {
              this.$router.push('/unit');
            }
          }
        })
      },
    },
  }
</script>